package com.iqik.ioc.utils;

import com.iqik.ioc.anno.Autowired;
import com.iqik.ioc.anno.Service;

import java.sql.SQLException;

@Service
public class TransactionalManager {

    @Autowired
    private ConnectionUtils connectionUtils;


    public void begin() throws SQLException {
        connectionUtils.getCurrentThreadConn().setAutoCommit(false);
    }

    public void commit() throws SQLException {
        connectionUtils.getCurrentThreadConn().commit();
    }

    public void rollback() throws SQLException {
        connectionUtils.getCurrentThreadConn().rollback();
    }
}
